 datatypes xs="http://www.w3.org/2001/XMLSchema-datatypes"
 element library { 
  element book {
   attribute id {xs:NMTOKEN {maxLength = "16"}},
   attribute available {xs:boolean "true"},
   element isbn {xs:NMTOKEN {pattern = "[0-9]{9}[0-9x]"}},
   element title {
     attribute xml:lang {xs:language {length="2"}}, 
     xs:token {maxLength="255"}
   },
   element author {
    attribute id {xs:NMTOKEN {maxLength = "16"}},
    element name {xs:token {maxLength = "255"}},
    element born {xs:date {
      minInclusive = "1900-01-01"
      maxInclusive = "2099-12-31"
      pattern = "[0-9]{4}-[0-9]{2}-[0-9]{2}"
    }},
    element dead {xs:date {
      minInclusive = "1900-01-01"
      maxInclusive = "2099-12-31"
      pattern = "[0-9]{4}-[0-9]{2}-[0-9]{2}"
    }}?}*,
   element character {
    attribute id {xs:NMTOKEN {maxLength = "16"}},
    element name {xs:token {maxLength = "255"}},
    element born {xs:date {
      minInclusive = "1900-01-01"
      maxInclusive = "2099-12-31"
      pattern = "[0-9]{4}-[0-9]{2}-[0-9]{2}"
    }},
    element qualification {xs:token {maxLength = "255"}}}*
  } +
 }
